<?php
/**
 * Category Admin List View
 * 
 * Lists all categories and provides links to edit, delete, etc.
 */
?>
<div class="header">
	<h2>Category Admin</h2>
	<div class="add">
		<a href="<?= $this->routeUrl('admin_category_add') ?>">Create New Category</a> | 
		<a href="<?= $this->routeUrl('admin_category_reorder') ?>">Change Category Order</a>
	</div>
	<div style="clear:both"></div>
</div>
<div id="categoryadmin">
	<table class="admin">
		<thead>
			<tr>
				<th><a href="<?= $this->routeUrl('admin_category_list', null, array('order' => 'category_id', 'dir' => $this->dir)) ?>">ID</a></th>
				<th><a href="<?= $this->routeUrl('admin_category_list', null, array('order' => 'name', 'dir' => $this->dir)) ?>">Name</a></th>
				<th><a href="<?= $this->routeUrl('admin_category_list', null, array('order' => 'order', 'dir' => $this->dir)) ?>">Order</a></th>
				<?php /* <th><a href="<?= $this->routeUrl('admin_category_list', null, array('order' => 'description', 'dir' => $this->dir)) ?>">Description</a></th> */ ?>
				<?php /* <th><a href="<?= $this->routeUrl('admin_category_list', null, array('order' => 'parentname', 'dir' => $this->dir)) ?>">Parent Name</a></th> */ ?>
				<th><a href="<?= $this->routeUrl('admin_category_list', null, array('order' => 'is_active', 'dir' => $this->dir)) ?>">Active?</a></th>
				<th> &nbsp; </th>
			</tr>
		</thead>
		<tbody>
			<?php foreach ($this->categories as $cat): ?>
				<tr class="category <?= $this->cycle(array('odd', 'even'))->next() ?>">
					<th class="category_id"><?= $this->e($cat['category_id']) ?></th>
					<td class="name"><a href="<?= $this->routeUrl('admin_category_edit', array('category_id' => $cat['category_id'])) ?>"><?= $this->e($cat['name']) ?></a></td>
					<td class="order"><?= (empty($cat['order'])) ? 'None' : $cat['order'] ?></td>
					<?php /* <td class="description"><?= $this->e($cat['description']) ?></td> */ ?>
					<?php /* <td class="parentname"><a href="<?= $this->routeUrl('admin_category_edit', array('category_id' => $cat['parent_id'])) ?>"><?= $this->e($cat['parentname']) ?></a></td> */ ?>
					<td class="is_active"><?php echo ($cat['is_active']) ? "Yes" : "No" ?></td>
					<td class="admin"><a href="<?= $this->routeUrl('admin_category_edit', array('category_id' => $cat['category_id'])) ?>">Edit</a>&nbsp;|&nbsp;<a href="<?= $this->routeUrl('admin_category_delete', array('category_id' => $cat['category_id'])) ?>" onclick="return confirm('Are you sure you want to delete this category?')">Delete</a></td>
				</tr>
			<?php endforeach ?>
		</tbody>
	</table>
	
	<?= $this->paginationControl($this->categories) ?>

</div> <!-- /#productadmin -->